package com.hooda.container;

import com.hooda.servlet.HttpServlet;

/**
 * 对应webapps下的一个项目
 * @author zhangzp
 * @version 1.0, 2021/10/15
 */
public class Wrapper {

    private String servletClass;

    private HttpServlet servlet = null;

    public Wrapper(String servletClass) {
        this.servletClass = servletClass;
        init();
    }

    public void init() {
        if (null == servletClass) {
            return;
        }

        try {
            this.servlet = (HttpServlet) Class.forName(servletClass).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public HttpServlet getServlet() {
        return servlet;
    }
}
